<div class="container">
    Lokasi 
    &nbsp;&nbsp;
    : <input type="text" id="lokasi" style="width: 18.5em;"/>
</div>
<script type="text/javascript">
    $(document).ready(function() {
        $("#lokasi").autocomplete({
            source: function(request, response) {
                $.ajax({
                    url: "<?php echo site_url("service/autocompletesearch/locall"); ?>",
                    method: "POST",
                    dataType: "json",
                    data: {
                        keywords: request.term
                    },
                    success: function(data) {
                        response(data);
                    }
                });
            },
            minLength: 2,
            focus: function(event, ui) {
                $("#lokasi").val(ui.item.label);
                return false;
            },
            select: function(event, ui) {
                $("#lokasi").val(ui.item.label);
                $("#lokasi").blur();
                return false;
            }
        });
    });
</script>